
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>4.2 Endpoint · Kubernetes - 痴者工良</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="痴者工良">
        
        
    
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="3.ingress.html" />
    
    
    <link rel="prev" href="1.network.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://www.whuanle.cn" target="_blank" class="custom-link">痴者工良的博客</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    文档说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    1.基础知识
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../1.basic/">
            
                <a href="../1.basic/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../1.basic/1.docker.html">
            
                <a href="../1.basic/1.docker.html">
            
                    
                    1.1 说透 Docker：基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../1.basic/2.virtual.html">
            
                <a href="../1.basic/2.virtual.html">
            
                    
                    1.2 说透 Docker： 虚拟化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="../1.basic/3.docker_network.html">
            
                <a href="../1.basic/3.docker_network.html">
            
                    
                    1.3 了解 Docker 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="../1.basic/4.pod_docker.html">
            
                <a href="../1.basic/4.pod_docker.html">
            
                    
                    1.4 Docker 和 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="../1.basic/5.k8s.html">
            
                <a href="../1.basic/5.k8s.html">
            
                    
                    1.5 K8S入门基础
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../2.deploy/">
            
                <a href="../2.deploy/">
            
                    
                    2.部署和配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../2.deploy/2.deploy.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../2.deploy/1.minikube.html">
            
                <a href="../2.deploy/1.minikube.html">
            
                    
                    2.1 使用 Minikube 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../2.deploy/2.kubeadm.html">
            
                <a href="../2.deploy/2.kubeadm.html">
            
                    
                    2.2 使用 kubeadm 部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../2.deploy/3.kubeadm_ckad.html">
            
                <a href="../2.deploy/3.kubeadm_ckad.html">
            
                    
                    2.3 CKAD认证中的部署教程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../2.deploy/4.kubeadm_proxy.html">
            
                <a href="../2.deploy/4.kubeadm_proxy.html">
            
                    
                    2.4 国内代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../2.deploy/5.dashboard.html">
            
                <a href="../2.deploy/5.dashboard.html">
            
                    
                    2.5 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    3.Pod部署和调度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../3.pod/">
            
                <a href="../3.pod/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../3.pod/1.pod.html">
            
                <a href="../3.pod/1.pod.html">
            
                    
                    3.1 Pod
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../3.pod/2.deployment.html">
            
                <a href="../3.pod/2.deployment.html">
            
                    
                    3.2 Deployment部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="../3.pod/3.replica.html">
            
                <a href="../3.pod/3.replica.html">
            
                    
                    3.3 副本集(ReplicaSet)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.5" data-path="../3.pod/4.pod_network.html">
            
                <a href="../3.pod/4.pod_network.html">
            
                    
                    3.34 Pod 端口映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.6" data-path="../3.pod/5.update.html">
            
                <a href="../3.pod/5.update.html">
            
                    
                    3.5 Pod 升级、回滚
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.7" data-path="../3.pod/6.scale.html">
            
                <a href="../3.pod/6.scale.html">
            
                    
                    3.6 Pod 缩放
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.8" data-path="../3.pod/7.lable.html">
            
                <a href="../3.pod/7.lable.html">
            
                    
                    3.7.Pod 标签
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.9" data-path="../3.pod/8.schedule.html">
            
                <a href="../3.pod/8.schedule.html">
            
                    
                    3.8 Pod 调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.10" data-path="../3.pod/9.jobs_cronjobs.html">
            
                <a href="../3.pod/9.jobs_cronjobs.html">
            
                    
                    3.9 Jobs、CronJobs
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="./">
            
                <a href="./">
            
                    
                    4.Kubernetes 网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="./">
            
                <a href="./">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="1.network.html">
            
                <a href="1.network.html">
            
                    
                    4.1 Kubernetes 网络
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.3" data-path="2.endpoint.html">
            
                <a href="2.endpoint.html">
            
                    
                    4.2 Endpoint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="3.ingress.html">
            
                <a href="3.ingress.html">
            
                    
                    4.3 ingress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="4.discovery.html">
            
                <a href="4.discovery.html">
            
                    
                    4.4 服务发现
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    5.volumes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../5.volumes/">
            
                <a href="../5.volumes/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../5.volumes/1.volumes.html">
            
                <a href="../5.volumes/1.volumes.html">
            
                    
                    5.1 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../5.volumes/2.secret_configmap.html">
            
                <a href="../5.volumes/2.secret_configmap.html">
            
                    
                    5.2 secret 和 ConfigMap 卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../5.volumes/3.nfts.html">
            
                <a href="../5.volumes/3.nfts.html">
            
                    
                    5.3 NFS卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../5.volumes/4.pv_pvc.html">
            
                <a href="../5.volumes/4.pv_pvc.html">
            
                    
                    5.4 持久化卷
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    6.API 和 安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../6.api_safe/">
            
                <a href="../6.api_safe/">
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../7.health/">
            
                <a href="../7.health/">
            
                    
                    7.维护和故障排除
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../8.health/README.md">
            
                <span>
            
                    
                    导读
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../k8s.html">
            
                <a href="../k8s.html">
            
                    
                    Kubernetes 命令概览
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../ckad.html">
            
                <a href="../ckad.html">
            
                    
                    CKAD 认证帮助
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >4.2 Endpoint</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#42-endpoint"><b></b>4.2 Endpoint</a></li><ul><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;-endpoint&#x3001;service"><b></b>&#x521B;&#x5EFA; Endpoint&#x3001;Service</a></li><ul><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;-service"><b></b>&#x521B;&#x5EFA; Service</a></li><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;&#x5E94;&#x7528;"><b></b>&#x521B;&#x5EFA;&#x5E94;&#x7528;</a></li><li><span class="title-icon "></span><a href="#&#x521B;&#x5EFA;-endpoint"><b></b>&#x521B;&#x5EFA; Endpoint</a></li><li><span class="title-icon "></span><a href="#&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;"><b></b>&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;</a></li></ul></ul></ul></div><h1 id="42-endpoint"><a name="42-endpoint" class="anchor-navigation-ex-anchor" href="#42-endpoint"><i class="fa fa-link" aria-hidden="true"></i></a>4.2 Endpoint</h1>
<p>&#x5F53;&#x6211;&#x4EEC;&#x4E3A;&#x4E00;&#x4E2A; Deployment &#x7B49;&#x5BF9;&#x8C61;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; Service &#x65F6;&#xFF0C;Service &#x4F1A;&#x81EA;&#x52A8;&#x521B;&#x5EFA; Endpoint&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x67E5;&#x770B;&#x9ED8;&#x8BA4;&#x547D;&#x540D;&#x7A7A;&#x95F4;&#x7684; Endpoint&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">kubectl get endpoints
</code></pre>
<pre class="language-"><code class="lang-bash">NAME         ENDPOINTS                                            AGE
kubernetes   <span class="token number">10.170</span>.0.2:6443                                      3d7h
nginx        <span class="token number">192.168</span>.56.24:80,192.168.56.25:80,192.168.56.26:80   59m
</code></pre>
<pre class="language-"><code>nginx-55649fd747-67twm   1/1     Running     0          5d21h   192.168.56.24 
nginx-55649fd747-vntwb   1/1     Running     0          5d21h   192.168.56.25   
nginx-55649fd747-wmrlv   1/1     Running     0          5d21h   192.168.56.26
</code></pre><p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#xFF0C;Endpoint &#x4E2D;&#x7684;&#x591A;&#x4E2A; IP&#xFF0C;&#x5BF9;&#x5E94;&#x4E86;&#x6BCF;&#x4E00;&#x4E2A; Pod &#x7684; IP&#xFF0C;&#x5176;&#x663E;&#x793A;&#x7684;&#x7AEF;&#x53E3;&#xFF0C;&#x4E5F;&#x6B63;&#x662F;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x66B4;&#x9732;&#x7684;&#x7AEF;&#x53E3;&#x3002;Endpoint &#x8BB0;&#x5F55;&#x4E86;&#x4E00;&#x7EC4; Pod &#x7684; IP &#x5730;&#x5740;&#xFF0C;&#x5F53;&#x4F7F;&#x7528; Service &#x4E3A; Pod &#x66B4;&#x9732;&#x7F51;&#x7EDC;&#x65F6;&#x4F1A;&#x4ECE; Endpoint &#x4E2D;&#x83B7;&#x5F97; Pod &#x7684; IP &#x5217;&#x8868;&#xFF0C;&#x4EE5;&#x4FBF;&#x80FD;&#x591F;&#x5C06;&#x6D41;&#x91CF;&#x4EE3;&#x7406;&#x5230;&#x5408;&#x9002;&#x7684; Pod IP&#x3002;</p>
<p>&#x5047;&#x5982;&#xFF0C;&#x516C;&#x53F8;&#x521B;&#x5EFA;&#x4E86; A&#x3001;B &#x4E24;&#x4E2A;&#x5F00;&#x53D1;&#x5C0F;&#x7EC4;&#xFF0C;&#x72EC;&#x7ACB;&#x5F00;&#x53D1;&#x4E00;&#x4E2A;&#x4EA7;&#x54C1;&#xFF0C;&#x5176;&#x4E2D; A &#x5E94;&#x7528;&#x4F9D;&#x8D56; B &#x5E94;&#x7528;&#xFF0C;&#x9700;&#x8981;&#x901A;&#x8FC7;&#x8FDC;&#x7A0B;&#x8BBF;&#x95EE;&#x83B7;&#x53D6; B &#x4E2D;&#x7684;&#x6570;&#x636E;&#x3002;&#x7531;&#x4E8E;&#x4E24;&#x4E2A;&#x5C0F;&#x7EC4;&#x90FD;&#x521A;&#x521A;&#x6210;&#x7ACB;&#xFF0C;&#x5404;&#x65B9;&#x9762;&#x90FD;&#x8FD8;&#x6CA1;&#x6709;&#x786E;&#x5B9A;&#xFF0C;&#x6211;&#x4EEC;&#x5982;&#x4F55;&#x5728;&#x5C3D;&#x5FEB;&#x4E3A;&#x4E24;&#x4E2A;&#x5C0F;&#x7EC4;&#x5728;&#x8FDC;&#x7A0B;&#x8C03;&#x7528;&#x4E0A;&#x8FBE;&#x6210;&#x4E00;&#x4E9B;&#x786E;&#x5B9A;&#xFF1F;&#x4F7F;&#x7528; Consul &#x7B49;&#x670D;&#x52A1;&#x6CE8;&#x518C;&#x548C;&#x53D1;&#x73B0;&#xFF1F;&#x8FD9;&#x4E5F;&#x592A;&#x590D;&#x6742;&#x4E86;&#x5427;&#xFF0C;&#x800C;&#x4E14; IP &#x4E5F;&#x9700;&#x8981;&#x63D0;&#x524D;&#x786E;&#x5B9A;&#x5440;&#xFF0C;&#x4E5F;&#x6CA1;&#x6709;&#x66F4;&#x7B80;&#x5355;&#x7684;&#x65B9;&#x6CD5;&#x5462;&#xFF1F;</p>
<h2 id="&#x521B;&#x5EFA;-endpoint&#x3001;service"><a name="&#x521B;&#x5EFA;-endpoint&#x3001;service" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;-endpoint&#x3001;service"><i class="fa fa-link" aria-hidden="true"></i></a>&#x521B;&#x5EFA; Endpoint&#x3001;Service</h2>
<p>&#x672C;&#x8282;&#x5C06;&#x4ECB;&#x7ECD;&#x5982;&#x4F55;&#x624B;&#x52A8;&#x521B;&#x5EFA; Endpoint&#x3001;Service&#x3002;</p>
<h3 id="&#x521B;&#x5EFA;-service"><a name="&#x521B;&#x5EFA;-service" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;-service"><i class="fa fa-link" aria-hidden="true"></i></a>&#x521B;&#x5EFA; Service</h3>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x6CA1;&#x6709;&#x9009;&#x62E9;&#x5668;&#x7684; Service &#xFF0C;&#x6B64; Service &#x6CA1;&#x6709;&#x7ED1;&#x5B9A;&#x4EFB;&#x4F55; Pod&#xFF0C; service.yaml &#x6587;&#x4EF6;&#x5185;&#x5BB9;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Service
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> nginx
<span class="token key atrule">spec</span><span class="token punctuation">:</span>
  <span class="token key atrule">ports</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token key atrule">protocol</span><span class="token punctuation">:</span> TCP
      <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">6666</span>
      <span class="token key atrule">targetPort</span><span class="token punctuation">:</span> <span class="token number">80</span>
</code></pre>
<blockquote>
<p>Service &#x8DDF; Endpoint &#x4E0D;&#x80FD;&#x76F4;&#x63A5;&#x5173;&#x8054;&#xFF0C;&#x4E24;&#x8005;&#x901A;&#x8FC7; <code>metadata.name</code> &#x4E2D;&#x5B9A;&#x4E49;&#x76F8;&#x540C;&#x7684;&#x540D;&#x79F0;&#x8FDB;&#x884C;&#x533A;&#x914D;&#x3002;</p>
</blockquote>
<p>&#x5E94;&#x7528; YAML&#xFF1A;</p>
<pre class="language-"><code>kubectl apply -f service.yaml
</code></pre><p>&#x67E5;&#x770B; Service  &#x548C; Endpooint&#xFF1A;</p>
<pre class="language-"><code class="lang-bash">root@master:~<span class="token comment"># kubectl get svc</span>
NAME           TYPE        CLUSTER-IP    EXTERNAL-IP   PORT<span class="token punctuation">(</span>S<span class="token punctuation">)</span>                               AGE
kubernetes     ClusterIP   <span class="token number">10.96</span>.0.1     <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">443</span>/TCP                               3d16h
nginx          ClusterIP   <span class="token number">10.96</span>.204.132   <span class="token operator">&lt;</span>none<span class="token operator">&gt;</span>        <span class="token number">6666</span>/TCP                              2s
root@master:~<span class="token comment"># kubectl get endpoints</span>
NAME           ENDPOINTS       AGE
kubernetes     <span class="token number">10.0</span>.0.4:6443   3d17h
</code></pre>
<p>&#x7531;&#x4E8E;&#x6B64; Service &#x6CA1;&#x6709;&#x5B9A;&#x4E49;&#x9009;&#x62E9;&#x5668;&#xFF0C;&#x56E0;&#x6B64; Service &#x4E0D;&#x4F1A;&#x81EA;&#x52A8;&#x521B;&#x5EFA; Endpoint&#xFF0C;&#x53E6;&#x5916;&#x6B64; Service &#x6CA1;&#x6709; Pod &#x53EF;&#x7528;&#xFF0C;&#x6682;&#x65F6;&#x4E0D;&#x80FD;&#x63D0;&#x4F9B;&#x53EF;&#x7528;&#x7684;&#x670D;&#x52A1;&#x3002;</p>
<p>&#x4F46;&#x662F;&#xFF0C;&#x6B64;&#x65F6;&#x5DF2;&#x7ECF;&#x80FD;&#x591F;&#x786E;&#x5B9A;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; nginx &#x7684; Service &#x7684; IP &#x5730;&#x5740;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x6B64; IP &#x5DF2;&#x7ECF;&#x53EF;&#x4EE5;&#x786E;&#x5B9A;&#x3002;&#x6211;&#x4EEC;&#x628A;&#x5404;&#x4E2A;&#x73AF;&#x8282;&#x89E3;&#x8026;&#x4E86;&#xFF0C;&#x6211;&#x4EEC;&#x65E0;&#x9700;&#x5148;&#x786E;&#x5B9A;&#x5177;&#x4F53;&#x7684;&#x5E94;&#x7528;&#xFF0C;A&#x3001;B &#x4E24;&#x4E2A;&#x5F00;&#x53D1;&#x7EC4;&#xFF0C;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x7A7A;&#x7684; Service&#xFF0C;&#x786E;&#x5B9A;&#x4E86; IP &#x548C;&#x7AEF;&#x53E3;&#xFF0C;&#x7136;&#x540E; A&#x3001;B &#x7EC4;&#x7EE7;&#x7EED;&#x5F00;&#x53D1;&#x5E94;&#x7528;&#xFF0C;&#x5F85; B &#x7EC4;&#x5F00;&#x53D1;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x76F4;&#x63A5;&#x90E8;&#x7F72; Pod&#xFF1B;&#x800C; A &#x7EC4;&#x53EF;&#x4EE5;&#x5728; B &#x5E94;&#x7528;&#x6CA1;&#x6709;&#x5F00;&#x53D1;&#x5B8C;&#x6210;&#x524D;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x786E;&#x5B9A;&#x8981;&#x4F7F;&#x7528;&#x7684; IP&#x3002;&#x5728;&#x8FD9;&#x91CC;&#xFF0C;&#x6211;&#x4EEC;&#x5047;&#x8BBE; B &#x7EC4;&#x7684;&#x5E94;&#x7528;&#x53EB; nginx&#x3002;</p>
<h3 id="&#x521B;&#x5EFA;&#x5E94;&#x7528;"><a name="&#x521B;&#x5EFA;&#x5E94;&#x7528;" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;&#x5E94;&#x7528;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x521B;&#x5EFA;&#x5E94;&#x7528;</h3>
<p>&#x73B0;&#x5728; B &#x7EC4;&#x5F00;&#x53D1;&#x51FA;&#x4E86;&#x5E94;&#x7528;&#x7684;&#x96CF;&#x5F62;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x4E00;&#x90E8;&#x5206;&#x529F;&#x80FD;&#x4E86;&#xFF0C;&#x90A3;&#x4E48;&#x8981;&#x5148;&#x90E8;&#x7F72;&#x5230;&#x4E91;&#x7AEF;&#xFF0C;&#x8BA9; A &#x7EC4;&#x8FDE;&#x63A5;&#x6D4B;&#x8BD5;&#x3002;&#x6CE8;&#x610F;&#xFF0C;B &#x7EC4;&#x7684;&#x5E94;&#x7528;&#x4E0D;&#x9700;&#x8981;&#x90E8;&#x7F72;&#x5230; Kubernetes &#x4E2D;&#xFF0C;&#x53EA;&#x8981;&#x80FD;&#x591F;&#x77E5;&#x9053;&#x6B64;&#x5E94;&#x7528;&#x7684; IP &#x548C;&#x7AEF;&#x53E3;&#x5373;&#x53EF;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x968F;&#x4FBF;&#x627E;&#x53F0; Worker &#x6216;&#x8005; Master &#x8282;&#x70B9;&#xFF0C;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; nginx &#x5BB9;&#x5668;&#xFF1A;</p>
<pre class="language-"><code>docker run -itd -p 80:80 nginx:latest
</code></pre><p>&#x4E3A;&#x4EC0;&#x4E48;&#x4E0D;&#x7528; Pod&#xFF0C;&#x76F4;&#x63A5;&#x521B;&#x5EFA;&#x5BB9;&#x5668;&#xFF1F;&#x56E0;&#x4E3A;&#x6211;&#x4EEC;&#x5904;&#x4E8E;&#x5F00;&#x53D1;&#x9636;&#x6BB5;&#xFF0C;&#x5982;&#x679C;&#x628A; nginx &#x6539;&#x6210; mysql&#xFF0C;&#x6211;&#x4EEC;&#x8981; Debug &#x5462;&#xFF1F;&#x6D4B;&#x8BD5;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#x5E93;&#x5462;&#xFF1F;&#x8981;&#x6A21;&#x62DF;&#x6570;&#x636E;&#x5462;&#xFF1F;&#x5982;&#x679C;&#x76F4;&#x63A5;&#x4F7F;&#x7528; Pod&#xFF0C;&#x8C03;&#x8BD5;&#x4F1A;&#x6BD4;&#x8F83;&#x9EBB;&#x70E6;&#xFF0C;&#x6211;&#x4EEC;&#x5728;&#x751F;&#x4EA7;&#x65F6;&#x518D;&#x901A;&#x8FC7; Deployment &#x521B;&#x5EFA;&#x5E94;&#x7528;&#xFF0C;&#x4F46;&#x662F;&#x6B64;&#x65F6;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; Docker &#x90E8;&#x7F72;&#x81EA;&#x5DF1;&#x7684;&#x6570;&#x636E;&#x5E93;&#x6216;&#x8005;&#x672C;&#x5730;&#x5E94;&#x7528;&#xFF0C;Docker &#x8C03;&#x8BD5;&#x6BD4;&#x8F83;&#x5BB9;&#x6613;&#xFF0C;&#x540C;&#x65F6;&#x4E5F;&#x5F88;&#x5BB9;&#x6613;&#x64CD;&#x4F5C;&#x3002;&#x5F53;&#x7136;&#xFF0C;&#x53BB;&#x6389; Docker &#x4E5F;&#x662F;&#x53EF;&#x4EE5;&#x7684;&#x3002;</p>
<p>&#x603B;&#x4E4B;&#xFF0C;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x4E86; Service&#xFF0C;&#x53EF;&#x4EE5;&#x63D0;&#x4F9B;&#x4E86;&#x62BD;&#x8C61;&#xFF0C;&#x81F3;&#x4E8E;&#x600E;&#x4E48;&#x63D0;&#x4F9B;&#x8FD9;&#x4E2A;&#x670D;&#x52A1;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; Pod &#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528; Docker&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x670D;&#x52A1;&#x5668;&#x4E2D;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x547D;&#x4EE4;&#x542F;&#x52A8;&#x7A0B;&#x5E8F;&#x800C;&#x4E0D;&#x4F7F;&#x7528;&#x5BB9;&#x5668;&#x3002;&#x603B;&#x4E4B;&#xFF0C;&#x6211;&#x4EEC;&#x76EE;&#x524D;&#x628A;&#x591A;&#x4E2A;&#x73AF;&#x8282;&#x89E3;&#x8026;&#x4E86;&#xFF0C;A &#x7EC4;&#x53EA;&#x9700;&#x8981;&#x5173;&#x5FC3;&#x901A;&#x8FC7; Service &#x4E2D;&#x7684; IP &#x548C;&#x7AEF;&#x53E3;&#x80FD;&#x591F;&#x8BBF;&#x95EE;&#x5230; B &#x5E94;&#x7528;&#x5373;&#x53EF;&#xFF1B;&#x5BF9;&#x5E94; B &#x7EC4;&#xFF0C;&#x5176;&#x5F00;&#x53D1;&#x7684;&#x5E94;&#x7528;&#x8FD8;&#x5904;&#x4E8E;&#x8FED;&#x4EE3;&#x4E2D;&#xFF0C;&#x76F4;&#x63A5;&#x4E0A; Kubernetes &#xFF0C;&#x4E0D;&#x662F;&#x4E00;&#x4E2A;&#x597D;&#x9009;&#x62E9;&#xFF0C;&#x53EF;&#x4EE5;&#x4E34;&#x65F6;&#x4F7F;&#x7528; Docker &#x5FEB;&#x901F;&#x90E8;&#x7F72;&#x3002;</p>
<p>&#x5728;&#x524D;&#x9762;&#xFF0C;Docker &#x5DF2;&#x7ECF;&#x90E8;&#x7F72;&#x5B8C;&#x6210;&#x4E86;&#xFF0C;&#x63A5;&#x7740;&#x67E5;&#x8BE2;&#x8FD9;&#x4E2A;&#x5BB9;&#x5668;&#x7684; ip&#xFF0C;&#xFF1A;</p>
<pre class="language-"><code>docker inspect {&#x5BB9;&#x5668;id} | grep IPAddress
</code></pre><p>&#x7B14;&#x8005;&#x5F97;&#x5230;&#x7684;&#x662F;&#x7ED3;&#x679C;&#x662F;<code>&quot;IPAddress&quot;: &quot;172.17.0.3&quot;</code>&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x5728;&#x5F53;&#x524D;&#x670D;&#x52A1;&#x5668;&#x4E2D;&#x4F7F;&#x7528; <code>curl 172.17.0.3</code> &#xFF0C;&#x6D4B;&#x8BD5;&#x662F;&#x5426;&#x80FD;&#x591F;&#x8BBF;&#x95EE; nginx&#xFF0C;&#x5982;&#x679C;&#x6CA1;&#x95EE;&#x9898;&#x6211;&#x4EEC;&#x6765;&#x8FDB;&#x884C;&#x4E0B;&#x4E00;&#x6B65;&#x64CD;&#x4F5C;&#x3002;</p>
<h3 id="&#x521B;&#x5EFA;-endpoint"><a name="&#x521B;&#x5EFA;-endpoint" class="anchor-navigation-ex-anchor" href="#&#x521B;&#x5EFA;-endpoint"><i class="fa fa-link" aria-hidden="true"></i></a>&#x521B;&#x5EFA; Endpoint</h3>
<p>&#x73B0;&#x5728;&#xFF0C;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x4E86; Service&#xFF0C;&#x80FD;&#x591F;&#x7ED9; A &#x7EC4;&#x7684;&#x5E94;&#x7528;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A; IP &#x548C;&#x7AEF;&#x53E3;&#xFF0C;&#x540C;&#x65F6; B &#x7EC4;&#x4E5F;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x4E34;&#x65F6;&#x6D4B;&#x8BD5;&#x7684;&#x540E;&#x7AEF;(&#x4EC0;&#x4E48;&#x5F62;&#x5F0F;&#x90FD;&#x884C;)&#xFF0C;&#x4F46;&#x662F;&#x73B0;&#x5728; Service &#x8FD8;&#x6CA1;&#x6709;&#x5173;&#x8054;&#x8FD9;&#x4E2A;&#x540E;&#x7AEF;&#xFF0C;&#x6682;&#x65F6;&#x4E0D;&#x80FD;&#x901A;&#x8FC7; Service &#x8BBF;&#x95EE; B &#x5E94;&#x7528;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x6211;&#x4EEC;&#x5C06;&#x8FD9;&#x4E24;&#x8005;&#x5173;&#x8054;&#x8D77;&#x6765;&#x3002;</p>
<p>&#x521B;&#x5EFA;&#x4E00;&#x4E2A; endpoint.yaml &#x6587;&#x4EF6;&#xFF0C;&#x5185;&#x5BB9;&#x5982;&#x4E0B;(&#x6CE8;&#x610F;&#x66FF;&#x6362;ip&#x4E3A;&#x4F60;&#x5BB9;&#x5668;&#x8BBF;&#x95EE;ip)&#xFF1A;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">apiVersion</span><span class="token punctuation">:</span> v1
<span class="token key atrule">kind</span><span class="token punctuation">:</span> Endpoints
<span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">name</span><span class="token punctuation">:</span> nginx
<span class="token key atrule">subsets</span><span class="token punctuation">:</span>
  <span class="token punctuation">-</span> <span class="token key atrule">addresses</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">ip</span><span class="token punctuation">:</span> 172.17.0.3
    <span class="token key atrule">ports</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">80</span>
</code></pre>
<blockquote>
<p><code>metadata.name</code> &#x540D;&#x79F0;&#x5FC5;&#x987B;&#x8DDF; Service &#x4E00;&#x81F4;&#xFF0C;&#x5426;&#x5219;&#x4E0D;&#x4F1A;&#x76F8;&#x533A;&#x914D;&#x3002;</p>
</blockquote>
<p>&#x7136;&#x540E;&#x5E94;&#x7528;&#x6B64; yaml&#xFF1A;</p>
<pre class="language-"><code>kubectl apply -f endpoint.yaml
</code></pre><p>&#x67E5;&#x770B; Endpoint&#xFF1A;</p>
<pre class="language-"><code>kubectl get endpoints
# &#x4E0D;&#x80FD;&#x586B;&#x5199;&#x6210; endpoint
</code></pre><pre class="language-"><code>NAME         ENDPOINTS         AGE
nginx        172.17.0.3:80     7s
</code></pre><p>&#x7136;&#x540E;&#x8BBF;&#x95EE; Service &#x4E2D;&#x7684; IP&#xFF1A;</p>
<pre class="language-"><code>curl 10.96.204.132:6666
</code></pre><p><img src="images/service_endpoint.png" alt="service_endpoint"></p>
<p>&#x5982;&#x679C; Endpoint &#x9700;&#x8981;&#x8DDF;&#x8E2A;&#x591A;&#x4E2A; IP (&#x591A;&#x4E2A; Pod &#x6216;&#x8005;&#x5BB9;&#x5668;&#x6216;&#x8005;&#x5E94;&#x7528;)&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#xFF1A;</p>
<pre class="language-"><code>  - addresses:
      - ip: 172.17.0.2
      - ip: 172.17.0.3
      - ip: 172.17.0.4
      ... ...
</code></pre><p>&#x6211;&#x4EEC;&#x5B9A;&#x4E49;&#x597D; Service &#x548C; Ednpoint &#x540E;&#xFF0C;&#x540E;&#x7EED; Debug &#x5E94;&#x7528;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x6DFB;&#x52A0;&#x5B9E;&#x4F8B;&#x6570;&#x91CF;&#xFF0C;&#x8BA9; B &#x5E94;&#x7528;&#x4E00;&#x76F4;&#x80FD;&#x591F;&#x5FEB;&#x901F;&#x8FED;&#x4EE3;&#x3002;&#x5982;&#x679C; B &#x5E94;&#x7528;&#x5F00;&#x53D1;&#x5B8C;&#x6BD5;&#xFF0C;&#x5219;&#x5E94;&#x8BE5;&#x4F7F;&#x7528; Pod &#x90E8;&#x7F72;&#x3002;</p>
<p>&#x540E;&#x7EED;&#x4F7F;&#x7528; Pod &#x65F6;&#xFF0C;&#x4FEE;&#x6539;&#x5176; <code>metadata</code>&#xFF0C;&#x52A0;&#x4E0A;&#x9009;&#x62E9;&#x5668;&#x3002;</p>
<pre class="language-"><code class="lang-yaml"><span class="token key atrule">metadata</span><span class="token punctuation">:</span>
  <span class="token key atrule">annotations</span><span class="token punctuation">:</span>
  <span class="token key atrule">labels</span><span class="token punctuation">:</span>
    <span class="token key atrule">app</span><span class="token punctuation">:</span> ngin
  <span class="token key atrule">name</span><span class="token punctuation">:</span> nginx
  <span class="token key atrule">namespace</span><span class="token punctuation">:</span> default
</code></pre>
<div class="mermaid">
graph TD;
    &#x7528;&#x6237; ==&gt; Service(B Service 10.96.204.132)
    Service ==&gt; Endpoint(B Endpoint 10.32.0.1,10.32.0.2,10.32.0.3)
    Endpoint ==&gt; Pod1(Pod1 10.32.0.1)
    Endpoint ==&gt; Pod2(Pod2 10.32.0.2)
    Endpoint ==&gt; Pod3(Pod3 10.32.0.3)
</div>





<h3 id="&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;"><a name="&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;" class="anchor-navigation-ex-anchor" href="#&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x8FDE;&#x63A5;&#x5916;&#x90E8;&#x670D;&#x52A1;</h3>
<p>&#x5047;&#x5982;&#xFF0C;&#x5E94;&#x7528;&#x4F9D;&#x8D56;&#x4E8E; Redis &#x3001;Mysql&#xFF0C;&#x4F46;&#x662F;&#x8003;&#x8651;&#x4E86;&#x81EA;&#x5EFA; Mysql &#x7684;&#x590D;&#x6742;&#x6027;&#x548C;&#x5B95;&#x673A;&#x4FEE;&#x590D;&#x96BE;&#x5EA6;&#xFF0C;&#x51B3;&#x5B9A;&#x4F7F;&#x7528;&#x4E91;&#x5E73;&#x53F0;&#x7684; Mysql &#x670D;&#x52A1;&#x3002;</p>
<p>&#x597D;&#x7684;&#xFF0C;&#x73B0;&#x5728;&#x516C;&#x53F8;&#x4E70;&#x4E86;&#x4E91;&#x5E73;&#x53F0;&#x7684; &#x591A;&#x8282;&#x70B9; Mysql &#x670D;&#x52A1;&#xFF0C;&#x5176;&#x4E2D;&#x6709;&#x4E24;&#x4E2A;&#x4E3B; &#x8282;&#x70B9;&#xFF0C;&#x5BF9;&#x5916;&#x63D0;&#x4F9B;&#x670D;&#x52A1;&#xFF0C;&#x5176; IP &#x5206;&#x522B;&#x4E3A;&#xFF1A;</p>
<pre class="language-"><code>111.111.111.111
222.222.222.222
</code></pre><p>&#x4F46;&#x662F;&#xFF0C;Mysql &#x670D;&#x52A1;&#x5728;&#x4E91;&#x670D;&#x52A1;&#x5668;&#x4E0A;&#xFF0C;&#x4E0D;&#x5728;&#x81EA;&#x5DF1;&#x7684; Kubernetes &#x96C6;&#x7FA4;&#x4E0A;&#xFF0C;&#x6211;&#x4EEC;&#x60F3;&#x5728;&#x96C6;&#x7FA4;&#x4E2D;&#x521B;&#x5EFA;&#x4E00;&#x4E2A; Service &#x6765;&#x5BF9;&#x8FD9;&#x4E24;&#x4E2A; IP &#x8FDB;&#x884C;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#xFF0C;&#x90A3;&#x4E48;&#xFF0C;&#x6211;&#x4EEC;&#x600E;&#x4E48;&#x5728; A &#x5E94;&#x7528;&#x4E2D;&#x8BBF;&#x95EE; Mysql&#xFF1F;&#x5199;&#x6B7B; IP&#xFF1F;&#x4F46;&#x662F;&#x73B0;&#x5728;&#x6709;&#x4E24;&#x4E2A; Mysql IP&#xFF0C;&#x4EE3;&#x7801;&#x91CC;&#x9762;&#x53EA;&#x80FD;&#x5199;&#x4E00;&#x4E2A;&#x5440;&#xFF0C;&#x8FD9;&#x6837;&#x600E;&#x4E48;&#x505A;&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#xFF1F;</p>
<p>&#x6B64;&#x65F6;&#xFF0C;&#x8FD8;&#x662F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; Service&#x3001;Endpoint &#x7684;&#x3002;&#x65E0;&#x975E;&#x5C31;&#x662F;&#x5728; Endpoint &#x7684; IP &#x5217;&#x8868;&#x4E2D;&#xFF0C;&#x4F7F;&#x7528;&#x516C;&#x7F51; IP&#x3002;</p>
<pre class="language-"><code class="lang-yaml">  <span class="token punctuation">-</span> <span class="token key atrule">addresses</span><span class="token punctuation">:</span>
      <span class="token punctuation">-</span> <span class="token key atrule">ip</span><span class="token punctuation">:</span> 111.111.111.111
      <span class="token punctuation">-</span> <span class="token key atrule">ip</span><span class="token punctuation">:</span> 222.222.222.222
      <span class="token punctuation">...</span> <span class="token punctuation">...</span>
  <span class="token punctuation">-</span> <span class="token key atrule">ports</span><span class="token punctuation">:</span> 
      <span class="token punctuation">-</span> <span class="token key atrule">port</span><span class="token punctuation">:</span> <span class="token number">3306</span>
</code></pre>
<p>&#x8FD9;&#x6837;&#xFF0C;&#x5728;&#x96C6;&#x7FA4;&#x4E2D;&#x8FD8;&#x662F;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; Service &#x7684; IP(&#x5185;&#x7F51;)&#xFF0C;A &#x5E94;&#x7528;&#x4E0D;&#x9700;&#x8981;&#x77E5;&#x9053;&#x6709;&#x591A;&#x5C11;&#x4E2A; Mysql &#x5B9E;&#x4F8B;&#xFF0C;&#x4E5F;&#x4E0D;&#x9700;&#x8981;&#x77E5;&#x9053; Mysql &#x7684; IP &#x4F1A;&#x4E0D;&#x4F1A;&#x53D8;&#x5316;&#x6216;&#x8005;&#x67D0;&#x4E00;&#x5929;&#x6302;&#x6389;&#x4E86;&#xFF0C;&#x4E5F;&#x4E0D;&#x9700;&#x8981;&#x5173;&#x5FC3;&#x5E73;&#x8861;&#x8BBF;&#x95EE; Mysql &#x7684;&#x6D41;&#x91CF;&#xFF0C;&#x6211;&#x4EEC;&#x53EA;&#x9700;&#x8981;&#x77E5;&#x9053; Service &#x7684; IP &#x5373;&#x53EF;&#x3002;</p>
<p><img src="images/service_endpoint2.png" alt="service_endpoint2"></p>
<footer class="page-footer"><span class="copyright">Copyright &#xA9; &#x75F4;&#x8005;&#x5DE5;&#x826F; 2021 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x6587;&#x6863;&#x6700;&#x540E;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2021-11-17 07:19:33
</span></footer>
<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="1.network.html" class="navigation navigation-prev " aria-label="Previous page: 4.1 Kubernetes 网络">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="3.ingress.html" class="navigation navigation-next " aria-label="Next page: 4.3 ingress">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"4.2 Endpoint","level":"1.5.3","depth":2,"next":{"title":"4.3 ingress","level":"1.5.4","depth":2,"path":"4.network/3.ingress.md","ref":"4.network/3.ingress.md","articles":[]},"previous":{"title":"4.1 Kubernetes 网络","level":"1.5.2","depth":2,"path":"4.network/1.network.md","ref":"4.network/1.network.md","articles":[]},"dir":"ltr"},"config":{"plugins":["tbfed-pagefooter","anchor-navigation-ex","mermaid-gb3","insert-logo","chapter-fold","advanced-emoji","github","splitter","alerts","popup","prism","-highlight","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy 痴者工良 2021","modify_label":"文档最后更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"chapter-fold":{},"prism":{"lang":{"flow":"typescript","shell":"bash"},"ignore":["mermaid","eval-js"],"css":["prismjs/themes/prism.css"],"js":["prismjs/prism.js","prismjs/components.js","prismjs/components/prism-go.min.js","prismjs/components/prism-yaml.min.js","prismjs/components/prism-bash.min.js","prismjs/components/prism-shell-session.min.js"]},"github":{"url":"https://github.com/whuanle/kubernetes"},"livereload":{},"splitter":{},"search":{},"popup":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"mermaid-gb3":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"alerts":{},"advanced-emoji":{"embedEmojis":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"insert-logo":{"style":"background: none; max-height: 50px; min-height: 50px","url":"/images/logo.jpg"}},"theme":"default","author":"痴者工良","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Kubernetes - 痴者工良","language":"zh-hans","links":{"sidebar":{"痴者工良的博客":"https://www.whuanle.cn"}},"gitbook":"*","description":"这是一本关于 Kubernetes 的书，作者 痴者工良"},"file":{"path":"4.network/2.endpoint.md","mtime":"2021-11-16T23:19:33.030Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-11-16T23:21:22.294Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

